<template>
	<view>
		<u-navbar
			:title="title"
			:title-width="570"
			:border-bottom="false"
			:background="{ background: '#0049AC' }"
			title-color="#fff"
			:is-back="false"
		>
			<view slot="right" style="margin-right: 25rpx;" @click="showMenu = true">
				<u-icon
					name="more-dot-fill"
					color="#fff"
					size="50"
				></u-icon>
			</view>
		</u-navbar>
		<u-popup v-model="showMenu" mode="top" border-radius="16">
			<view class="menu">
				<view class="status_bar">
				          <!-- 这里是状态栏 -->
				      </view>
				<view class="title">
					<text>{{$t('locales.directFunction')}}</text>
					<u-icon name="close" :size="35" @click="showMenu = false"></u-icon>
				</view>
				<u-grid :col="3" :border="false">
					<u-grid-item @click="navSwitch('/pages/index/home/index')">
						<u-icon name="home" :size="46"></u-icon>
						<view style="margin-top: 15rpx;" class="grid-text">
							{{$t('locales.homePage')}}
						</view>
					</u-grid-item>
					<u-grid-item @click="navSwitch('/pages/sort/index')">
						<u-icon name="grid" :size="46"></u-icon>
						<view style="margin-top: 15rpx;" class="grid-text">
							{{$t('locales.allCommodities')}}
						</view>
					</u-grid-item>
					<u-grid-item @click="navSwitch('/pages/shoppingCart/index')">
						<u-icon name="shopping-cart" :size="46"></u-icon>
						<view style="margin-top: 15rpx;" class="grid-text">
							{{$t('locales.shoppingCart')}}
						</view>
					</u-grid-item>
					<u-grid-item @click="navSwitch('/pages/order/list/index', 2)">
						<u-icon name="list-dot" :size="46"></u-icon>
						<view style="margin-top: 15rpx;" class="grid-text">
							{{$t('locales.orderManagement')}}
						</view>
					</u-grid-item>
					<u-grid-item @click="navSwitch('/pages/user/collection/index', 2)">
						<u-icon name="heart" :size="46"></u-icon>
						<view style="margin-top: 15rpx;" class="grid-text">
							{{$t('locales.myCollection')}}
						</view>
					</u-grid-item>
					<u-grid-item @click="navSwitch('/pages/me/index')">
						<u-icon name="account" :size="46"></u-icon>
						<view style="margin-top: 15rpx;" class="grid-text">
							{{$t('locales.personalCenter')}}
						</view>
					</u-grid-item>
				</u-grid>
			</view>
		</u-popup>
	</view>
</template>

<script>
	export default {
		props: {
			title: {
				type: String,
				default: ''
			}
		},
		data() {
			return {
				showMenu: false,
			};
		},
		methods: {
			navSwitch(url, type = 1) {
				if (type === 1) {
					uni.reLaunch({
						url
					})
				} else {
					uni.navigateTo({
						url
					})
				}
			}
		}
	}
</script>

<style lang="scss" scoped>
.menu {
	padding: 30rpx;
	.status_bar {
	      height: var(--status-bar-height);
	      width: 100%;
	  }
	.title {
		display: flex;
		justify-content: space-between;
		align-items: center;
		margin-bottom: 30rpx;
	}
}
</style>
